package com.nbsaas.boot.room.rest.resource;

import com.nbsaas.boot.room.api.apis.RoomPriceApi;
import com.nbsaas.boot.room.data.entity.RoomPrice;
import com.nbsaas.boot.room.api.domain.request.RoomPriceRequest;
import com.nbsaas.boot.room.api.domain.response.RoomPriceResponse;
import com.nbsaas.boot.room.api.domain.simple.RoomPriceSimple;
import com.nbsaas.boot.room.rest.convert.RoomPriceSimpleConvert;
import com.nbsaas.boot.room.rest.convert.RoomPriceEntityConvert;
import com.nbsaas.boot.room.rest.convert.RoomPriceResponseConvert;
import com.nbsaas.boot.room.data.repository.RoomPriceRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   业务接口实现
*/
@Transactional
@Service
public class RoomPriceResource extends BaseResource<RoomPrice,RoomPriceResponse, RoomPriceSimple, RoomPriceRequest>  implements RoomPriceApi {

    @Resource
    private RoomPriceRepository roomPriceRepository;

    @Override
    public JpaRepositoryImplementation<RoomPrice, Serializable> getJpaRepository() {
        return roomPriceRepository;
    }

    @Override
    public Function<RoomPrice, RoomPriceSimple> getConvertSimple() {
        return new RoomPriceSimpleConvert();
    }

    @Override
    public Function<RoomPriceRequest, RoomPrice> getConvertForm() {
        return new RoomPriceEntityConvert();
    }

    @Override
    public Function<RoomPrice, RoomPriceResponse> getConvertResponse() {
        return new RoomPriceResponseConvert();
    }




}


